/**
 * Created by wangyg 
 * on 2017/6/16 16:44
 */
public class Demo {
	public static void main(String[] args) throws InterruptedException {
		System.out.println("妈妈和儿子两个人在家");
		System.out.println("老王在敲门");
		Son s = new Son();
		Mother m = new Mother();
		s.start();
		m.start();

		try {
			s.join();
			//			m.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println("老王回去了");

	}

	static class Son extends Thread {
		public void run() {
			System.out.println("儿子下去买酱油。。。");
			try {
				Thread.sleep(3000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			System.out.println("儿子买酱油回来了，在敲门");
		}
	}

	static class Mother extends Thread {
		public void run() {
			System.out.println("他妈随着儿子出去走到了门口");
			System.out.println("2个小时后，看到儿子到楼下，赶紧进了门");
		}
	}
}
